package com.xiaolun.memento.theory;

public class Client {
	public static void main(String[] args) {
		Originator originator = new Originator(); //创建一个原生对象
		Caretaker caretaker = new Caretaker();

		originator.setState(" 状态#1 攻击力 100 "); //设置状态

		//保存了当前的状态
		caretaker.add(originator.saveStateMemento());

		//保存状态2
		originator.setState(" 状态#2 攻击力 80 ");
		caretaker.add(originator.saveStateMemento());

		System.out.println("当前的状态是 =" + originator.getState());

		//希望得到状态 1, 将 originator 恢复到状态1
		originator.getStateFromMemento(caretaker.get(0));
		System.out.println("恢复到状态1 , 当前的状态是");
		System.out.println("当前的状态是 =" + originator.getState());
	}
}
